﻿using IEntities;
using IRepository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Repository
{
    public abstract class BaseRepository<TEntity> : IBaseRepository<TEntity> where TEntity : class, IEntity
    {
        public abstract object[] Test();
        public abstract int Count();
        public abstract int Count(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<int> CountAsync();
        public abstract Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract bool Delete(TEntity entity);
        public abstract Task DeleteAsync(TEntity entity);
        public abstract bool DeleteByID(object id);
        public abstract Task DeleteByIDAsync(object id);
        public abstract bool Deletes(dynamic[] ids);
        public abstract Task DeletesAsync(dynamic[] ids);
        public abstract TEntity Find(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract TEntity FindByID(object id);
        public abstract Task<TEntity> FindByIDAsync(object id);
        public abstract TEntity FirstOrDefault(object id);
        public abstract TEntity FirstOrDefault(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<TEntity> FirstOrDefaultAsync(object id);
        public abstract Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract TEntity Get(object id);
        public abstract TEntity Get(Expression<Func<TEntity, bool>> whereExpression);
        public abstract List<TEntity> GetAllList();
        public abstract List<TEntity> GetAllList(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<List<TEntity>> GetAllListAsync();
        public abstract Task<List<TEntity>> GetAllListAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<TEntity> GetAsync(object id);
        public abstract Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract TEntity Insert(TEntity entity);
        public abstract object InsertAndGetID(TEntity entity);
        public abstract Task<object> InsertAndGetIDAsync(TEntity entity);
        public abstract Task<TEntity> InsertAsync(TEntity entity);
        public abstract List<TEntity> Query(Expression<Func<TEntity, bool>> whereExpression);
        public abstract Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> whereExpression);
        public abstract List<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 10, int pageCount = 10);
        public abstract Task<List<TEntity>> QueryPageAsync(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 10, int pageCount = 10);
        public abstract TEntity Update(TEntity entity);
        public abstract object UpdateAndGetID(TEntity entity);
        public abstract Task<object> UpdateAndGetIDAsync(TEntity entity);
        public abstract Task<TEntity> UpdateAsync(TEntity entity);
        public abstract List<TEntity> Updates(List<TEntity> entities);
        public abstract Task<List<TEntity>> UpdatesAsync(List<TEntity> entities);
    }
}
